var ywcDGDoctorPerfDialog;
var scoreQuota = [];
var hospTotalQuota = [];
var perfQuota_drg = [];
var perfQuota_rule = [];
$(function() {
	showCondition(true, 0, 0, 1, []);
	var drg = $("#tabContent > .tab-pane.active").data();
	if (drg.value == "undefined") {
		paramTabPage[tabId].depCode = $("#depCode").val();
		paramTabPage[tabId].wardCode = $("#wardCode").val();
	} else {
		paramTabPage[tabId] = drg;
	}
	scoreQuota = [{
				"quotaCode" : "TotalScore",
				"quotaName" : "综合得分"
			}, {
				"quotaCode" : "CapacityScore",
				"quotaName" : "产能得分"
			}, {
				"quotaCode" : "EfficiencyScore",
				"quotaName" : "效率得分"
			}, {
				"quotaCode" : "QualityScore",
				"quotaName" : "安全得分"
			}]
	hospTotalQuota = [{
				"quotaCode" : "CMI",
				"quotaName" : "CMI值"
			}, {
				"quotaCode" : "DRGCount",
				"quotaName" : "DRGs组数"
			}, {
				"quotaCode" : "TotalWeight",
				"quotaName" : "总权重"
			}, {
				"quotaCode" : "AvgFee",
				"quotaName" : "次均费用(元)"
			}, {
				"quotaCode" : "TotalCaseCnt",
				"quotaName" : "出院病例数"
			}, {
				"quotaCode" : "TimeEff",
				"quotaName" : "时间消耗指数"
			}, {
				"quotaCode" : "FeeEff",
				"quotaName" : "费用消耗指数"
			}, {
				"quotaCode" : "WeightPerBed",
				"quotaName" : "每床日权重"
			}, {
				"quotaCode" : "Risk1Ratio",
				"quotaName" : "低风险死亡率(%)"
			}, {
				"quotaCode" : "Risk2Ratio",
				"quotaName" : "中低风险死亡率(%)"
			}]
	perfQuota_drg = [{
				"quotaCode" : "CMI",
				"quotaName" : "CMI值"
			}, {
				"quotaCode" : "DRGCount",
				"quotaName" : "DRGs组数"
			}, {
				"quotaCode" : "InCaseCnt",
				"quotaName" : "入组病例数 "
			}, {
				"quotaCode" : "PatientBaseRate",
				"quotaName" : "患者基本费率 "
			}, {
				"quotaCode" : "TimeEff",
				"quotaName" : "时间消耗指数"
			}, {
				"quotaCode" : "FeeEff",
				"quotaName" : "费用消耗指数"
			}, {
				"quotaCode" : "Risk1Ratio",
				"quotaName" : "低风险死亡率(%)"
			}, {
				"quotaCode" : "Risk2Ratio",
				"quotaName" : "中低风险死亡率(%)"
			}, {
				"quotaCode" : "TotalWeight",
				"quotaName" : "总权重"
			}]

	perfQuota_rule = [{
				"quotaCode" : "MaterialRatio",
				"quotaName" : "耗占比(%)"
			}, {
				"quotaCode" : "TotalCaseCnt",
				"quotaName" : "出院病例数"
			}, {
				"quotaCode" : "AvgDays",
				"quotaName" : "平均住院日"
			}, {
				"quotaCode" : "AvgFee",
				"quotaName" : "次均费用(元)"
			}, {
				"quotaCode" : "TotalFee",
				"quotaName" : "总费用(万元)"
			}, {
				"quotaCode" : "CureRatio",
				"quotaName" : "治愈好转率(%)"
			}, {
				"quotaCode" : "DeadRatio",
				"quotaName" : "死亡率(%)"
			}, {
				"quotaCode" : "DeadCaseCnt",
				"quotaName" : "死亡人数"
			}, {
				"quotaCode" : "DrugRatio",
				"quotaName" : "药占比(%)"
				}]
paramTabPage[tabId].drg=perfQuotaDrg;
paramTabPage[tabId].reg=perfQuotaReg;
/**
 * 获取显示的医师
 */
$.ajax({
			url : contextPath + "/systemConfig/getConfigByCode.dhc",
		data : {
			"alterParam" : "DOCTOR_SET"
		},
		dataType : "json",
		success : function(result) {
			if(result.success && result.data.length > 0){
				var layer = result.data;
				if (layer.indexOf("1") == -1) {
					$('#' + tabId + ' #tips').css("display",
							"block");
					return;
				}
				levels = layer.split(",");
				if (levels[0] == 1){
					loadHospDoctorBySeting('protomedicus','主任/副主任医师');
				}
				if (levels[1] == 1){
					loadHospDoctorBySeting('clinic', '主诊组');
				}
				if (levels[2] == 1){
					loadHospDoctorBySeting('resident', '住院医师');
				}
				if (levels[3] == 1){
					loadHospDoctorBySeting('physician', '主治医师');
				}
			}
		}
	});

});
/**
 *  @ Discription:副主任医师开始
 * @Autor ：liuhongjun
 * @returns any ywcDGDoctorPerf.js 2017年6月9日下午9:20:05
 */
function loadHospDoctorBySeting(doctorTtype, doctorDesc) {
	$("#" + tabId + " #doctor_" + doctorTtype).show();
	// 系统页面布局
	createHospPerfLayout(doctorTtype, doctorDesc)
	// 数据获取
	loadHospScoreQuotaData(doctorTtype, doctorDesc);
	// 获取全部参与副主任医师绩效指标比较汇总的副主任医师(雷达图)
	hospCompareDoctor(doctorTtype);
	// 副主任医师DRGs指标综合比较汇总表
	loadHospDoctorQuotaTable(doctorTtype);
};
/**
 * 
 * @param doctorTtype
 * @param doctorDesc
 * @returns创建div布局
 */
function createHospPerfLayout(doctorTtype, doctorDesc) {
	$('#' + tabId + ' #doctor_hosp_perf').html();
	var head_str = '';
	var foot_str = '';
	var body_str = '';
	head_str += '<div class="row rowhcq">' + '<div class="col-xs-12">'
			+ '<div class="boxcq clearfix">'
			+ ' <div class="ti"><i class="fa fa-file-text-o"></i>' + doctorDesc
			+ 'DRG指标综合比较汇总表</div>'
			+ '<ul class="nav nav-tabs boxnasvcq" role="tablist"></ul>'
			+ ' <div class="clearfix"></div>'
			+ '<div id="" class="tab-content">';

	foot_str += '  </div>' + '</div>' + '</div>' + '</div>';

	body_str += '<div role="tabpanel" class="tab-pane active" monitorName="'+ doctorDesc + '" quotaName="" quotaCode="" id="' + doctorTtype+ '-tc' + tabId + '"> ';
	body_str += '<div class="row padding100">';
	body_str += '     <div class="col-xs-5"> ';
	body_str += '       <div class="echartscq"></div> ';
	body_str += '      </div> ';
	body_str += '               <div class="col-xs-7 dataChangeSel"> ';
	body_str += '                   <table id="'+ doctorTtype+ '-score-table" class="display dataTable" width="100%" > ';
	body_str += '                       <caption class="contaotalsccq">'+ doctorDesc + '综合得分</caption> ';
	body_str += '                   </table> ';
	body_str += '               </div> ';
	body_str += '</div> </div>';
	$('#' + tabId + ' #doctor_hosp_perf').append(head_str + body_str + foot_str);

	body_str = '';
	body_str += '<div id="hospPerf" class="tab-content">'
			+ '<div id="'+ doctorTtype+ '-well" class="form-horizontal well" style="padding: 10px">'
			+ '<div class="form-group" >'
			+ '<div class="row" ><label class="control-label" style="width:120px;float:left;margin-top: 10px;">'
			+ doctorDesc + ':&nbsp;</label>'
			+ '<div class="yishiSelected" id="' + doctorTtype+ 'Codes">  <ul></ul> </div></div>'
			+'<div class="row"><div class="col-xs-3 col-xs-offset-6"> <div id="showMore_'+doctorTtype+'"><a href="#" style="text-decoration:none"><i class="icon-plus-sign" style="font-size: 25px;"></i></a></div> </div></div>'
			+'</div> </div>'
			+ '<div class="paddingd10">' + '<div class="row">'
			+ '<div class="col-xs-6">' + '<div id="' + doctorTtype
			+ 'PerfChart_drgs" class="echartscq" style="height:440px;"></div>'
			+ '</div> ' + '<div class="col-xs-6">' + '<div id="' + doctorTtype
			+ 'PerfChart_rule" class="echartscq" style="height:440px;"></div>'
			+ '</div></div></div></div>';
	$('#' + tabId + ' #doctor_hosp_perf').append(head_str + body_str + foot_str);

	body_str = '';
	body_str += '<div role="tabpanel" class="dataChangeSel" id="' + doctorTtype
			+ 'totalQuotasTable"></div>';
	$('#' + tabId + ' #doctor_hosp_perf').append(head_str + body_str + foot_str);
}
/**
 * 
 * @param doctorTtype
 * @param doctorDesc
 * @returns获取数据
 */
function loadHospScoreQuotaData(monitorType, doctorDesc) {	
	var columns = [{
		"data" : "ddesc",
		"title" : doctorDesc
	 }, {
		"data" : "QuotaValue",
		"title" : "综合得分"
	}, {
		"data" : "CapacityScore",
		"title" : "产能得分"
	}, {
		"data" : "EfficiencyScore",
		"title" : "效率得分"
	}, {
		"data" : "QualityScore",
		"title" : "安全得分"
	}];
	var datas = [];
	var ajaxCnt = scoreQuota.length;
	for (var i in scoreQuota) {
		var quotaCode = scoreQuota[i].quotaCode;
		getPerfScoreTable(quotaCode, monitorType,
				function(quotaCode, data) {
					var data_s = [];
					data_s = data_s.concat(data);
					if (datas.length <= 0) {
						datas = data_s;
					}
					mergeListcc(datas, data_s,'ccode','',quotaCode);
					ajaxCnt--;
				});
	}
	var timer = setInterval(function() {
			if (ajaxCnt == 0) {
				clearInterval(timer);
				for(var i in datas){
					datas[i].QuotaValue=datas[i].TotalScore;
				}
				var paramsDataTables={order:[[1,'desc']],ordering:true};
				$("#" + tabId + " #"+monitorType+"-score-table").drgsDataTable(columns, datas, paramsDataTables);
			}
		}, 200);
	};
/**
 * 
 * @param quotaCode
 * @param monitorType
 * @param callback
 * @returns获取综合扥分数据
 */
function get_Hosp_Score_TableData(quotaCode, monitorType, callback) {
	var param = drgUI.setAjaxData(tabId);
	param.monitorType = monitorType;
	param.quotaCode = quotaCode;
	param.isGetCc = '0';
	$.post(contextPath + "/DrgsIndexCal/indexCal.dhc", param).done(
			function(res) {
				var data = [];
				if (res != undefined) {
					data = res.data;// 请求成功时处理
				}
				callback(data, quotaCode);
			});

}
/**
 *  @ Discription:获取医师
 * @Autor ：liuhongjun
 * @param hospTotalQuota
 * @param totalQuota_1
 * @param monitorType
 * @param method
 * @param doctorLevle医师钻取层次
 * @returns any ywcDGDoctorPerf.js 2017年6月10日下午10:08:08
 */
function hospCompareDoctor(monitorType) {
	var map = drgUI.setAjaxData(tabId);
	map.monitorType = monitorType;
	var role = $("#roleName_id").val();
	if(role=='科室'){
		map.pardepCode=map.deps;
	}
	// 获取医师数据
	$.post(contextPath + '/DrgsIndexCal/getDoctor.dhc', map).done(function(result) {
				if (result.success) {
					var protomedicusAll = result.data;
					if (jQuery.isEmptyObject(protomedicusAll)) {// 没有科室
						$('#' + tabId + ' #' + monitorType + 'Codes ul').html("无数据");
					} else {
						var str = "";
						$('#' + tabId + ' #' + monitorType + 'Codes ul').html("");
						if(role=='科室'){//科室角色时 科室下只有一个医师时 不显示比较对象
							 if(map.deps&&(protomedicusAll.length<2)) {
								 $('#' + tabId + ' #' + monitorType + '-well').css("display","none");
							 }
							 descval="授权科室均值";
						 }else{
							 descval = "全院均值";
						 }
						$.each(protomedicusAll, function(n, value) {
							if(n==0){
								str += "<li><input checked='checked' type='checkbox' name='"
									+ monitorType + "code' value='"
									+ value.CCODE + "' descval='"
									+ value.DDESC + "(" + value.DEP
									+ ")'/>" + value.DDESC + "("
									+ value.DEP + ")&nbsp;&nbsp;</li>";
							}else{
								str += "<li><input type='checkbox' name='"
									+ monitorType + "code' value='"
									+ value.CCODE + "' descval='"
									+ value.DDESC + "(" + value.DEP
									+ ")'/>" + value.DDESC + "("
									+ value.DEP + ")&nbsp;&nbsp;</li>";
							}
						});
						str += "<li><input  type='checkbox' name='"+ monitorType+ "code' value='hspstd' descval = '"+descval+"' >"+descval+"&nbsp;&nbsp;</li>";
						// 添加已经选中的复选框
						$('#' + tabId + ' #' + monitorType + 'Codes ul').append(str);
						if (protomedicusAll.length > 5) {
							// 添加已经选中的复选框
							var $category = $('#' + tabId + ' #' + monitorType+ 'Codes ul li:gt(6)');
							$category.hide();
							var $toggleBtn = $('#' + tabId + ' #showMore_'+monitorType+' a');
							$toggleBtn.toggle(function() {
										$category.show();
										$(this).find('i')
												.removeClass('icon-plus-sign')
												.addClass('icon-minus-sign')
												.css('color', 'red');
									}, function() {
										$category.hide();
										$(this).find('i')
												.removeClass('icon-minus-sign')
												.addClass('icon-plus-sign')
												.css('color', '#428BCA');
									});
						}else{
							$('#' + tabId + ' #showMore_'+monitorType).hide();
						}

						$('#' + tabId + ' input[name="' + monitorType
								+ 'code"]:checkbox').on('click', function() {
							if ($('#' + tabId + ' input[name="' + monitorType
									+ 'code"]:checkbox:checked').size() == 0) {
								$(this).attr('checked', 'checked');
							}
							hospDocrorCompare(1, monitorType);
							hospDocrorCompare(2, monitorType);
						});
					}
				}
				hospDocrorCompare(1, monitorType);
				hospDocrorCompare(2, monitorType);
			});
}
/**
 * 
 * @param sx
 * @param hospTotalQuota
 * @param monitorType
 * @param type
 * @returns医生比较绘制图
 */
function hospDocrorCompare(sx, monitorType, type) {
	var monitorName = "";
	if (monitorType == "depGroup") {
		monitorName = "科室组";
	} else if (monitorType == "dep") {
		monitorName = "科室";
	} else if (monitorType == "ward") {
		monitorName = "病区";
	} else if (monitorType == "protomedicus") {
		monitorName = "主任/副主任医师";
	} else if (monitorType == "resident") {
		monitorName = "住院医师";
	} else if (monitorType == "physician") {
		monitorName = "主治医师";
	} else if (monitorType == "clinic") {
		monitorName = "主诊组";
	}
	var titleName = "";
	var quotaType = "drgs";
	var hospTotalQuota = perfQuota_drg;
	if (sx == 1) {
		titleName = "DRG指标比较";
	} else if (sx == 2) {
		titleName = "常规指标比较";
		quotaType = "rule";
		hospTotalQuota = perfQuota_rule;
	}
	var allCompareObj = [];// 选中的比较对象
	if (type) {
		ywcDGDoctorPerfDialog.find('input[name="selectedObj"]').each(
				function() {
					allCompareObj.push({
								code : $(this).val(),
								val : $(this).attr("descval")
							});
				});
	} else {
		$('#' + tabId + ' input[name="' + monitorType + 'code"]:checked').each(
				function() {
					allCompareObj.push({
								code : $(this).val(),
								val : $(this).attr("descval")
							});
				});
	}
	// 拼表格
	var id = 'id' + new Date().getTime();
	var quotaData = [];// 存放各指标的代码，描述，值
	var lines = [];
	var ajaxCount = 0;
	for (var i = 0; i < allCompareObj.length; i++) {
		var lineDesc = allCompareObj[i].val;
		var lineCode = allCompareObj[i].code;
		var paramTemp = jQuery.extend(true, {}, paramTabPage[tabId]);
		// 获取全院均值和各分析对象的指标数据
		if (allCompareObj[i].code == "hspstd") {
			paramTemp.compareType = "hosp";// 查全院均值
			paramTemp.depGroupCode = "";
			// 获取全院均值计算(回调)
			loadAvgHospQuotas(monitorType, paramTemp, lineCode, lineDesc,
					function(result, lineCode, lineDesc) {
						if (result) {
							var line = {
								"code" : lineCode,
								"desc" : lineDesc,
								"data" : []
								//
							};
							quotaData.push(result);
							lines.push(line);// 拼蛛网图数据

						}
						ajaxCount++;
					});
		} else {
			paramTemp.compareType = "nothosp";// 非全院均值
			if (monitorType == "protomedicus") {
				paramTemp.pargroupName = "";
				paramTemp.resident = "";
				paramTemp.physician = "";
				paramTemp.protomedicus = (allCompareObj[i].code != "未入组"
						? allCompareObj[i].code
						: "");
			} else if (monitorType == "clinic") {
				paramTemp.protomedicus = "";
				paramTemp.resident = "";
				paramTemp.physician = "";
				paramTemp.pargroupName = (allCompareObj[i].code != "未入组"
						? allCompareObj[i].code
						: "");
			} else if (monitorType == "resident") {
				paramTemp.protomedicus = "";
				paramTemp.pargroupName = "";
				paramTemp.physician = "";
				paramTemp.resident = (allCompareObj[i].code != "未入组"
						? allCompareObj[i].code
						: "");
			} else if (monitorType == "physician") {
				paramTemp.protomedicus = "";
				paramTemp.resident = "";
				paramTemp.pargroupName = "";
				paramTemp.physician = (allCompareObj[i].code != "未入组"
						? allCompareObj[i].code
						: "");
			}
			loadAllQuotas(monitorType, paramTemp, lineCode, lineDesc, i,
					function(result, lineCode, lineDesc, i) {
						if (result) {
							var line = null;
							var line = {
								"index" : i,
								"code" : lineCode,
								"desc" : lineDesc,
								"data" : []
							};
							quotaData.push(result);
							lines.push(line);// 拼蛛网图数据
						}
						ajaxCount++;
					});
		}
	}
	// 等待数据返回
	var timer = setInterval(function() {
				lines.sort(function(a, b) {
							return a.index > b.index;
						})
				// 数据构造完以后画图
				if (ajaxCount == allCompareObj.length) {
					clearInterval(timer);
					var quotas = [];
					// 循环获取各指标的最大值
					for (var i in hospTotalQuota) {
						var quotaCode = hospTotalQuota[i].quotaCode;
						var quotaName = hospTotalQuota[i].quotaName;
						var maxValue = 0;
						// 循环上面压入的指标代码，描述，值
						for (var o in quotaData) {
							var value = Number(quotaData[o][quotaCode]);
							if (value > maxValue) {
								maxValue = value;
							}
						}
						var quotaNameMap = {
							name : quotaName,
							code : quotaCode,
							max : Math.ceil(maxValue)
						};
						quotas.push(quotaNameMap);
					}
					radarCharts($("#" + tabId + " #" + monitorType
									+ "PerfChart_" + quotaType), lines,
							quotaData, quotas, titleName, monitorName);
				}
			}, 1000);
}
/**
 * 
 * @param monitorType
 * @returns获取全院医师
 */
function loadHospDoctorQuotaTable(monitorType) {
	paramTabPage[tabId].hospTotalQuota = hospTotalQuota;
	var monitorName = "";
	var results = [];
	var quotasAll = [];
	var quotaCode = "PerfQuota";
	if (monitorType == "protomedicus") {
		monitorName = "主任/副主任医师";
	} else if (monitorType == "clinic") {
		monitorName = "主诊组";
	} else if (monitorType == "resident") {
		monitorName = "住院医师";
	} else if (monitorType == "physician") {
		monitorName = "主治医师";
	}
	var param = drgUI.setAjaxData(tabId);
	param.monitorType = monitorType;
	param.quotaCode = quotaCode;
	param.isGetCc = '0';
	$.post(contextPath + "/DrgsIndexCal/indexCal.dhc", param).done(
			function(res) {
				var data = [];
				if (res != undefined) {
					data = res.data;// 请求成功时处理
				}
				var str = '';
				var columns = [];
				column = {
					"data" : null,
					"defaultContent" : '',
					"className" : 'details-control',
					"width" : '30px'
				};
				columns.push(column);
				var column = {
					"data" : "",
					"render" : function(obj, type, full) {
						return full.ddesc != null ? full.ddesc : "未入组";
					}
				};
				columns.push(column);
				str += '<table id="'+ monitorType+ 'totalQuotas-table'+ tabId+ '" class="table table-striped" cellspacing="0" width="100%" role="grid" aria-describedby="example_info"> ';
				str += '    <caption class="contaotalsccq">' + monitorName+ 'DRG指标综合比较汇总表</caption> ';
				str += '    <thead> ';
				str += '    <tr> </tr> ';
				str += '    </thead> ';
				str += '    <tbody></tbody> ';
				str += '</table> ';
				var sth = '<th tabindex="0" aria-controls="example" rowspan="1" colspan="1" aria-sort="ascending" width="100px"></th> ';
				sth += '<th tabindex="0" aria-controls="example" rowspan="1" colspan="1" aria-sort="ascending" width="100px">'+ monitorName + '</th> ';
				var ajaxCount1 = 0;
				for (var o1 in hospTotalQuota) {
					ajaxCount1++;
					var quotaCode = hospTotalQuota[o1].quotaCode;
					var quotaName = hospTotalQuota[o1].quotaName;
					var isLink = hospTotalQuota[o1].isLink;
					col(quotaCode, quotaName, isLink);
				}
				function col(quotaCode, quotaName, isLink) {
					if (isLink == "1") {
						column = {
							"data" : null,
							"sType" : "number-html",
							"render" : function(obj, type, full) {
								if(full[quotaCode]==0){
									return full[quotaCode] ;
								} else {
									return "<a href=\"javascript:loadCaseDtl('"
									+ full.ddesc + "|" + quotaName + "|"
									+ "','" + full.ccode + "','"
									+ monitorType + "', '" + quotaCode
									+ "')\">"
									+ formatNumber(full[quotaCode])
									+ "</a>"
								}
							}
						};
					} else {
						column = {
							"data" : quotaCode,
							"sType" : "number-html",
							"render" : function(obj, type, full) {
								return "<span>" + formatNumber(full[quotaCode])
										+ "</span>"
							}
						};
					}
					sth += '<th tabindex="0" aria-controls="example" rowspan="1" colspan="1">'
							+ quotaName + '</th> ';
					columns.push(column);
					ajaxCount1--;
				}

				var timerId = window.setInterval(function() {
					if (ajaxCount1 == 0) {
						var ota;// 展开详情表格
						window.clearInterval(timerId);

						sth += '<th tabindex="0" aria-controls="example" rowspan="1" colspan="1">操作</th> ';
						column = {
							"data" : "OPERATION",
							"render" : function(obj, type, full) {
								return "<a title='趋势' href=\"javascript:trendPerf('1','"+ full.ccode+ "', '"+ full.ddesc+ "', '"+ monitorType+ "')\" class='trend-link'><i class='fa fa-line-chart'></i></a>";
							}
						}
						columns.push(column);
						$("#" + tabId + " #" + monitorType + "totalQuotasTable").html(str);
						$("#" + tabId + " #" + monitorType+ "totalQuotas-table" + tabId + " thead tr").html(sth);
						if (data[0] && data[0].ddesc == undefined) {
							var length = hospTotalQuota[0].data[0].data.length + 2;
							$("#" + tabId + " #" + monitorType+ "totalQuotas-table" + tabId + " tbody").html("<tr><td colspan='"+ length+ "' align='center'>表格中没有可用数据<td></tr>");
						} else {
							var paramsDataTables = {
								lengthChange : false,
								info : false,
								order:[],
								columnDefs : [{
											"orderable" : false,
											"targets" : [0,columns.length - 1]
										}]
							};
							var drawCallback = function(oSettings) { // table加载完成后回调事件
								$("[data-toggle='tooltip']").tooltip();
							}
							paramsDataTables.drawCallback = drawCallback;
							var oaTable = $("#" + tabId + " #" + monitorType+ "totalQuotas-table" + tabId).dataTableBasic(columns, data,paramsDataTables);
							/**
							 * 点击+展开详情
							 */
							$("#" + tabId + " #" + monitorType+ "totalQuotas-table" + tabId).find("tbody").off("click","td.details-control");
							$("#" + tabId + " #" + monitorType+ "totalQuotas-table" + tabId).find("tbody").on('click','td.details-control', function() {
												var nTr = $(this).closest('tr');
												var row = oaTable.row(nTr);
												var aData = row.data();
												if (row.child.isShown()) {//判断是否已打开
													row.child.hide();
													nTr.removeClass("shown");
												} else {
													var cloumStr = [{
																"title" : "科室",
																"data" : "ddesc"
															}];
													var qoutaCodes = [];
													for (var i in hospTotalQuota) {
														cloumStr.push({
															"title" : hospTotalQuota[i].quotaName,
															"data" : hospTotalQuota[i].quotaCode
														});
														qoutaCodes
																.push(hospTotalQuota[i].quotaCode);
													}
													nTr.addClass("shown");
													var data = [];
													var doctor_code = aData.ccode;
													findDoctorQuota(
															monitorType, 'dep',
															doctor_code,
															qoutaCodes,
															function(data) {
																//获取要查询的关联指标的指标代码
																try {
																	if (ota != undefined) {
																		ota.destroy();
																	}
																	var doctor_code = aData.ccode;
																	row.child("正在加载...").show();
																	row.child('<table id="'+ monitorType+ doctor_code+ 'totalQuotas-table" class="table"  width="100%" > </table>').show();
																	var paramsDataTables = {
																		searching : false,
																		paging : false,
																		lengthChange : false,
																		order:[],
																		info : false,
																		dom:'<"top"fl>rt<"bottom"ip><"clear">'
																	};
																	ota = $("#"+ tabId+ " #"+ monitorType+ doctor_code+ "totalQuotas-table").dataTableBasic(cloumStr,data,paramsDataTables);
																} catch (e) {
																	console.log(e)
																	row.child("出错了...").show();
																}
															});
												}
											});
						}
					}
				}, 200);
			});
}
